import argparse
import protobuffik.compiler as protobuffik


def __main__():
    parser = argparse.ArgumentParser(description = 'Tool for compiling protobuffik files')
    parser.add_argument("in", metavar = 'in', help = "input protobuffik file", nargs = 1)
    parser.add_argument("-l", "--lang", default = "cpp", choices = ["cpp"], help = "language")
    parser.add_argument("-t", "--type", default = "hash", choices = ["hash", "string"], help = "type of structure member's name")
    parser.add_argument("-o", "--out", help = "output file")
    
    args = vars(parser.parse_args())
    
    inputFile = args["in"][0]
    language = args["lang"]
    nameType = args["type"]
    outputFile = args["out"]
    
    if not inputFile:
        print(parser.format_help())
        return;
    
    if "help" in args:
        print(parser.format_help())
        return;
    
    protobuffik.RunCompiler(inputFile, language, nameType, outputFile)


if __name__ == "__main__":
    __main__()